#include <iostream>
#include <vector>
using namespace std;

int main() {
    // Eratosthenes 筛法
    vector<int> vis;
    int min, max;
    int result = 0;
    cin >> min >> max;
    vis.resize(max + 1, 0);
    for (int i = 2; i <= max; i++) {
        if (vis[i] == 0) {
            if (i >= min) { result++; }
            for(int j = i; j <= max; j += i) vis[j] = 1;
        }
    }
    cout << result;
}